﻿package Interface.TracksClasses
{	
	import Interface.ArrowButton;
	
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	public class TrackButton extends ArrowButton
	{		
		private var FCover:Sprite;
		private var FLabel:TrackButtonLabel;
		
		public function TrackButton() 
		{
			super();
			
			FLabel = new TrackButtonLabel('');
			addChild(FLabel);
			
			FCover = new Sprite();
			FCover.graphics.beginFill(0xFFFFFF, 0);
			FCover.graphics.drawRect(0, 0, width, height);
			FCover.graphics.endFill();
			FCover.buttonMode = true;
			FCover.useHandCursor = true;
			addChild(FCover);
			FCover.addEventListener(MouseEvent.MOUSE_OVER, OnMouseOver);
			FCover.addEventListener(MouseEvent.MOUSE_OUT, OnMouseOut);		
		}
		
		protected function OnMouseOver(e:MouseEvent):void
		{			
			FLabel.TextColor = FLabel.SelectdColor;
		}
		
		protected function OnMouseOut(e:MouseEvent):void
		{
			if(!FLabel.Selected)
				FLabel.TextColor = FLabel.NormalColor;
		}
		
		public function set Text(AText:String):void
		{
			FLabel.Text = AText;
		}
	}	
}
